Skip to content

Conversation

@dhyaniarun1993
Copy link
Collaborator

Utility for #446

emhane and others added 30 commits January 5, 2026 12:30
…163)

@dhyaniarun1993 @itschaindev @sadiq1971 @meyer9 think these are the only
crates we will need to touch. can update as we go. ideally the new logic
will only live inside of _crates/optimism_, but we may need to
generalise some components in the other crates I listed and make them
customisable up at SDK (node builder _crates/node_) level to achieve
this.
Closes #179

---------

Co-authored-by: Julian Meyer <[email protected]>
Fixes #177 

I added a few methods that should allow atomically pruning and reorging
blocks. Each function should represent a single transaction. We can
store trie nodes, reorg, prune in a single transaction now. I kept the
bulk insert methods available for storing the current state.

---------

Co-authored-by: Arun Dhyani <[email protected]>
Ref #176 

This PR adds an in-memory storage backend and tests that work with any
storage backend. We can easily add more test cases to the file to test
against a future SQLite backend.

---------

Co-authored-by: Arun Dhyani <[email protected]>
Co-authored-by: Emilia Hane <[email protected]>
Based on #183

This PR adds a backfill job that accepts a DB transaction and copies the
current state to the database. The transaction ensures we see a
consistent view of the database at the current block, even if the node
is syncing. This requires `--db.read-transaction-timeout 0`.

This currently doesn't handle interrupting the job because the state may
update while syncing and may read a different version of the database
upon restart.

---------

Co-authored-by: Arun Dhyani <[email protected]>
Co-authored-by: Emilia Hane <[email protected]>
No token, so this check always fails annoyingly. Disabling the upload
step if missing token.
Description:

- This PR adds scaffold MDBX proofs storage with impl to unblock
parallel work.
- Unblock multiple developers and avoid merge conflicts while the MDBX
backend is being built.
- Provide a compilable stub that wires types and env init, without
committing to final storage logic.
…e` (#204)

- Adds new crates `reth-optimism-exex` and `reth_optimism_trie`
- Moves `reth_exex::external_proofs` -> `reth_optimism_exex`
- Moves `reth_exex::external_proofs::storage` -> `reth_optimism_trie`
Seems like when `reth-optimism-trie` depends on `reth-db-api`
indirectly, the doctest crate couldn’t resolve `reth_db_api::…` and
failing.

Closes #233

Co-authored-by: Emilia Hane <[email protected]>
This PR separates storage and account cursors which makes sense because
these two cursors may have very different seek/next implementations. In
the case of in-memory, a single cursor impl can still handle both, but
for MDBX, it makes sense to implement separate cursors.

Closes #236

---------

Co-authored-by: Arun Dhyani <[email protected]>
Based on #203 ,
#204

This PR implements `StateProvider` given a `OpProofsStorage` instance.
It reads most data from the external database, but falls back on the
latest provider for block hashes and code by hash similar to the
existing historical provider in Reth.

This is an important part to implementing live syncing since we're
running the sync process on the DB being created.

In the Reth implementation, `proof.rs` is contained in `trie/db`, so I
think it makes sense to go in our DB crate. The `provider.rs` is in the
`reth-provider` crate, but I don't think a separate provider crate helps
us here, so I think we should also include that in the trie crate as
well.

---------

Co-authored-by: Emilia Hane <[email protected]>
Based on #229 

Adds tests to ensure that storing TrieUpdates that include deletions
actually deletes the nodes at that block height, and that updates take
precedence over deletions (same as `write_trie_updates` in Reth).

Closes #238
Based on #197

This PR implements the live state collector on top of the
`OpProofsStateProvider` created in the previous PR. This sync process
tries to re-execute all blocks from the current block of the external
database to tip.

---------

Co-authored-by: Emilia Hane <[email protected]>
Fixes #225 (does not track errors as these are fatal currently)
Fixes #237 

Adds more concrete error variants for `OpProofsStorageError`

Co-authored-by: Arun Dhyani <[email protected]>
Fixes #247 

Removes the `block_number` parameter from:
- store_account_branches
-  store_storage_branches
-  store_hashed_accounts
-  store_hashed_storages

Co-authored-by: Arun Dhyani <[email protected]>
Ref #241

- Fixes comment from deps fix in
#229 (fix correct but comment
misleading)
- `serde-bincode-compat` is a feature which must be enabled when the
`bincode` dependency is used. Asides for dev-deps, this only happens in
`reth-stages`. `reth-exex` runs in `reth-stages`. In this wokrstream we
use the `TrieUpdate` in exex. `serde-bincode-compat` is already
implemented for `TrieUpdates` in `reth-trie-common`, this PR simply
makes that feature accessible via `reth-trie` and in turn
`reth-optimism-trie`, in order to enable it in `reth-optimism-exex`.
Signed-off-by: Ignacio Hagopian <[email protected]>
Co-authored-by: Galoretka <[email protected]>
Co-authored-by: YK <[email protected]>
Co-authored-by: Federico Gimenez <[email protected]>
Co-authored-by: Matthias Seitz <[email protected]>
Co-authored-by: Arsenii Kulikov <[email protected]>
Co-authored-by: sashass1315 <[email protected]>
Co-authored-by: radik878 <[email protected]>
Co-authored-by: drhgencer <[email protected]>
Co-authored-by: James Prestwich <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: yongkangc <[email protected]>
Co-authored-by: Alexey Shekhirin <[email protected]>
Co-authored-by: Claude <[email protected]>
Co-authored-by: GarmashAlex <[email protected]>
Co-authored-by: Brian Picciano <[email protected]>
Co-authored-by: Roman Hodulák <[email protected]>
Co-authored-by: Dan Cline <[email protected]>
Co-authored-by: Mablr <[email protected]>
Co-authored-by: Skylar Ray <[email protected]>
Co-authored-by: kevaundray <[email protected]>
Co-authored-by: Wolfgang Welz <[email protected]>
Co-authored-by: Karl Yu <[email protected]>
Co-authored-by: MozirDmitriy <[email protected]>
Co-authored-by: AJStonewee <[email protected]>
Co-authored-by: Avory <[email protected]>
Co-authored-by: stevencartavia <[email protected]>
Co-authored-by: Léa Narzis <[email protected]>
Co-authored-by: futreall <[email protected]>
Co-authored-by: maradini77 <[email protected]>
Co-authored-by: crazykissshout <[email protected]>
Co-authored-by: Dharm Singh <[email protected]>
Co-authored-by: leopardracer <[email protected]>
Co-authored-by: Ignacio Hagopian <[email protected]>
Co-authored-by: Dmitry <[email protected]>
Co-authored-by: Micke <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-merge-queue <[email protected]>
Closes #212

---------

Co-authored-by: Emilia Hane <[email protected]>
Ref #205

Removes redundant dep `reth-db-api` from `reth-optimism-trie`, since
used types are re-exported via `reth-db`

---------

Co-authored-by: Arun Dhyani <[email protected]>
Resolves #239

---------

Co-authored-by: Einar Rasmussen <[email protected]>
@dhyaniarun1993 dhyaniarun1993 self-assigned this Jan 6, 2026
@dhyaniarun1993 dhyaniarun1993 added K-perf Kind: performance K-bench Kind: benchmark labels Jan 6, 2026
@codecov
Copy link

codecov bot commented Jan 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 38.34%. Comparing base (69f6061) to head (207d8d6).

Additional details and impacted files

Impacted file tree graph
see 2 files with indirect coverage changes

Flag Coverage Δ
e2e 35.74% <ø> (-0.01%) ⬇️
unit 26.89% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
reth binary 53.14% <ø> (ø)
op historical proof 90.12% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dhyaniarun1993 dhyaniarun1993 marked this pull request as ready for review January 7, 2026 08:54
Copilot AI review requested due to automatic review settings January 7, 2026 08:54
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a Go-based benchmark utility to measure the performance of the eth_getProof RPC method by testing historical proof requests against the WETH contract on Optimism. The utility is designed to support performance analysis for issue #446.

Key changes:

  • Implements a concurrent benchmark tool that measures eth_getProof latency across configurable block ranges
  • Targets WETH contract with pre-defined holder addresses and calculates storage slots for balance mappings
  • Reports aggregated latency statistics (avg/min/max) and error counts per block interval

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Member

@emhane emhane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we pls move this to a new directory op-reth-bench in
https://github.com/op-rs/op-reth/tree/unstable/bin

Copy link
Collaborator

@itschaindev itschaindev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

K-bench Kind: benchmark K-perf Kind: performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.